﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.Practices.Unity;
using Kkc.Application;

namespace Kkc.Presentation
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : KkcApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("Content/{*pathinfo}");
            routes.IgnoreRoute("clientbin/{*pathinfo}");

            routes.MapRoute(
                "PageLinkCreate",
                "PageLink/Create",
                new { controller = "PageLink", action = "Create" }
                );

            routes.MapRoute(
                "PageLinkDefault",
                "PageLink/{action}/{route}",
                new { controller = "PageLink", action = "List", route = string.Empty }
                );
            routes.MapRoute(
                "Page",
                "Page/{action}/{name}",
                new { controller = "Page", Action = "View", name = string.Empty }
                );
            routes.MapRoute(
                "Home",
                "Home/Page/{view}",
                new { controller = "Home", Action = "Page", view = string.Empty }
                );
            routes.MapRoute(
                "Photo1",
                "Photo/{action}/{id}",
                new { controller = "Photo", Action = "Index", id = string.Empty }
                );
            routes.MapRoute(
                "Photo2",
                "Photo/{action}/{albumId}/{id}",
                new { controller = "Photo", Action = "Index", albumId = string.Empty, id = string.Empty }
                );
            routes.MapRoute(
                "Default",                                              // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }
    }
}